﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace rock.common
{
    public class CPPDLL
    {
        [DllImport("CHECKVILAD.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int Check(string x, int y);
        [DllImport("CHECKVILAD.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int Getdate(int y, int m, int d);

        public static bool Test()
        {
            String y = DateTime.Now.Year +"";
            String m = DateTime.Now.Month + "";
            String d = DateTime.Now.Day + "";
            m = m.Length == 1 ? "0" + m : m +"";
            d = d.Length == 1 ? "0" + d : d +"";


            int result = CPPDLL.Check(y+m+d, 2);
            return result >= 0 ;
        }

        public static int Date()
        {
            int y = DateTime.Now.Year;
            int m = DateTime.Now.Month ;
            int d = DateTime.Now.Day;



            int result = CPPDLL.Getdate(y, m, d);
            return result;
        }
    }
}
